<?php

require_once('../include/GeneralTop.php');
require('../include/class/db.php');
require('../include/class/pagination.php');
require('../include/simpleHeader.php');

/*
die('<div style="text-align:center">'.TEXT_UNDER_CONSTRUCTION.'</div>');


if (!isset($_SESSION['Index_Username'])) {
	die('<div style="text-align:center">'.MSG_PERMISSION_DENIED.'</div>');
}
*/
?>
<body topmargin="0" leftmargin="0">
<table width="777" border="0" align="left" cellpadding="0" cellspacing="0" valign="top">
  <tr>
    <td width="777" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="51" valign="top" background="../images/fen_09.gif"><table width="95%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="16">&nbsp;</td>
            </tr>
          </table>
          <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td width="14"><img src="../images/fen_12.gif" width="7" height="29"></td>
              <td width="405"><span class="font_16px_black_B"><?php echo TEXT_INFO_BOOK?></span></td>
              <td width="15">&nbsp;</td>
              <td width="299">&nbsp;</td>
              </tr>
          </table></td>
        </tr>
      </table>
      <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="1" bgcolor="#767676"></td>
        </tr>
      </table>
      <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td height="8"></td>
        </tr>
      </table>
      <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="font_12px_gray">
        <tr>
          <td valign="top" class="font_12px_gray">
          <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0" class="table_border_grey">
  <tr>
  	<td width="100" class="font_12px_gray_h18" align="left"><?php echo TEXT_BOOK_PIC?></td>
  	<td width="250" class="font_12px_gray_h18" align="left"><?php echo TEXT_BOOK_NAME?></td>
    <td width="400" class="font_12px_gray_h18" align="left"><?php echo TEXT_BOOK_INFO?></td>
    <td width="100" class="font_12px_gray_h18" align="left"><?php echo TEXT_BOOK_AUTHOR?></td>
  </tr>
  
    <?php
    $db = new db;
	$sql = "SELECT Id, petopus_name, petopus_class, petopus_pic_thumb ,petopus_author, SUBSTRING(petopus_info,1,50) AS petopus_info FROM petopus WHERE petopus_class = ".OPUS_BOOK;
	$res = $db->query($sql);
	$num = $db->num($res);
	
	if($num > 0) {
		$pagination = new Pagination($num, PAGICATION_RECORD_COUNT_OPUS, $_GET['page'], PAGINATION_DELTA);
		$sql = $sql." limit ".$pagination->begin.",".$pagination->end;
		$res = $db->query($sql);
		while($row = $db->fetch($res)) {
			
    ?>
    <tr>      
      <td align="left"><a href="EducationParadiseinfo.php?Id=<?php echo $row['Id']; ?>" class="gray_12px"><img src="<?php echo IMAGES_OPUS_FOLDER.$row['petopus_pic_thumb']; ?>" border="0" class="img_border"></a></td>
      <td align="left"><a href="EducationParadiseinfo.php?Id=<?php echo $row['Id']; ?>" class="gray_12px"><?php echo $row['petopus_name']; ?></a></td>
      <td align="left"><?php echo $row['petopus_info']; ?>...&nbsp; </td>
      <td align="left"><?php echo $row['petopus_author']; ?></td>
    </tr>
    <?php
		}
	}
    ?>
</table>
<br />
<table border="0" align="left" cellpadding="0" cellspacing="5" class="font_12px_gray">
            <tr>
              <td>
              <?php
				if($num > PAGICATION_RECORD_COUNT_OPUS) {
					echo $pagination->paginationString;
				}
				?>
              </td>
              </tr>
          </table></p></td>
    </td>
  </tr>
</table>
</body>
</html>